package com.jml.蚂蚁.netty.序列化;


import java.io.IOException;
import java.util.UUID;
import org.msgpack.MessagePack;
import org.msgpack.type.Value;

/**
 * @author:jml
 * @date: 2019/12/25 9:43
 * @description：
 */
public class MessagePack网络序列化 {
	
	public static void main(String[] args) throws IOException {
		// 创建MessagePack
		MessagePack messagePack = new MessagePack();
		MsgEntity mt = new MsgEntity(UUID.randomUUID().toString(), "网络序列化");
		// 序列化
		byte[] bs = messagePack.write(mt);
		Value read1 = messagePack.read(bs);
		System.out.println(read1);
        // 反序列化
		MsgEntity read = messagePack.read(bs, MsgEntity.class);
		System.out.println(read);
	}
}
